package com.xcity.game.activity.thirtyday;

import naga.x.game.template.Template;
import naga.x.game.template.TemplateException;
import naga.x.game.template.annotation.Binding;
import naga.x.game.template.annotation.Excel;

/**
 * 豪华签到奖励
 * @author shipeng.zhu
 *
 */
@Excel(value = "activity.xlsx", sheetName = "豪华签到奖励")
public class ThirtyDayRechargeTemplate extends Template implements Comparable<ThirtyDayRechargeTemplate>{
	public static int RECHARGE_RECORD_FULL = 0xFFFFFFF;
	public static int RECHARGE_IDS_MAX = 7;
	public static int RECHARGE_COUNT_MAX = 3;

	/** 档位类型 */
	protected int type;

	/** 充值金额 */
	protected int rechargeMoney;

	/** 充值次数 */
	protected int rechargeCount;

	/** 奖励债券 */
	protected int bond;

	/** 奖励现金 */
	protected int money;

	/** 奖励物品1 */
	protected int[] itemIds;

	/** 数量 */
	protected int[] itemCounts;

	public int getType() {
		return type;
	}

	public void setType(int type) {
		this.type = type;
	}

	public int getRechargeMoney() {
		return rechargeMoney;
	}

	public void setRechargeMoney(int rechargeMoney) {
		this.rechargeMoney = rechargeMoney;
	}

	public int getRechargeCount() {
		return rechargeCount;
	}

	public void setRechargeCount(int rechargeCount) {
		this.rechargeCount = rechargeCount;
	}

	public int getBond() {
		return bond;
	}

	public void setBond(int bond) {
		this.bond = bond;
	}

	public int getMoney() {
		return money;
	}

	public void setMoney(int money) {
		this.money = money;
	}

	public int[] getItemIds() {
		return itemIds;
	}

	public void setItemIds(int[] itemIds) {
		this.itemIds = itemIds;
	}

	public int[] getItemCounts() {
		return itemCounts;
	}

	public void setItemCounts(int[] itemCounts) {
		this.itemCounts = itemCounts;
	}

	@Override
	public void validate() throws TemplateException {
		if(itemCounts == null){
			itemCounts = new int[]{};
		}
		if(itemIds == null){
			itemIds = new int[]{};
		}
		if(itemCounts.length != itemIds.length){
			throw new TemplateException("activity.xlsx 豪华签到奖励配置有误! id=" + id);
		}
	}

	@Override
	public int compareTo(ThirtyDayRechargeTemplate o) {
		if(this.getRechargeMoney() == o.getRechargeMoney()){
			return  this.getMoney() - o.getMoney();
		}
		return this.getRechargeMoney() - o.getRechargeMoney();
	}
}
